package com.kede.app.domain;

import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @description /
* @author Pr.li
* @date 2023-06-10
**/
@Entity
@Data
@Table(name="t_store_user_order")
public class StoreUserOrder implements Serializable {
    /**
    * 
    */
    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    private Integer id;
    /**
    * 门店id
    */
    @ApiModelProperty(value = "门店id")
    @Column(name = "`store_id`",nullable = false)
    @NotNull
    private Integer storeId;
    /**
    * 用户id
    */
    @ApiModelProperty(value = "用户id")
    @Column(name = "`user_id`",nullable = false)
    @NotNull
    private Integer userId;
    /**
    * 消费数量
    */
    @ApiModelProperty(value = "消费数量")
    @Column(name = "`num`",nullable = false)
    @NotNull
    private Integer num;
    /**
    * 物资id
    */
    @ApiModelProperty(value = "物资id")
    @Column(name = "`supplie_id`",nullable = false)
    @NotNull
    private Integer supplieId;
    /**
    * 状态：WATI(1,"门店待确认"),
     *     RECEVE(2,"已确认待领取"),
     *     REFUND(3,"退款中"),
     *     REFUNDED(4,"已退款"),
     *     FINISH(5,"已完成");
    */
    @ApiModelProperty(value = "状态：1 门店待确认 2 待领取 3 退款中 4已退款 5已完成")
    @Column(name = "`status`")
    private Integer status;
    /**
    * 
    */
    @ApiModelProperty(value = "createTime")
    @Column(name = "`create_time`",nullable = false)
    @NotNull
    private Timestamp createTime;

    @ApiModelProperty(value = "门店信息")
    @Transient
    private ZhiUserCertified store;

    @ApiModelProperty(value = "用户信息")
    @Transient
    private Users users;

    public void copy(StoreUserOrder source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
